﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Xml.Linq;

namespace NiconicoAPI {
    public class User {
        private const string Url_Login = "https://secure.nicovideo.jp/secure/login?site=niconico";
        private const string Url_Crt = "http://live.nicovideo.jp/api/getalertstatus?";
        //private const string Url_Login = "https://secure.nicovideo.jp/secure/login";

        internal CookieContainer NiconicoCokie { get; private set; }
        public bool IsLogin { get; private set; }

        public User(string mail, string password) {
            IsLogin = Login(mail, password);
        }

        private bool Login(string mail, string password) {
            NiconicoCokie = new CookieContainer();
            string value = string.Format("mail={0}&password={1}", mail, password);
            string result = WebLogic.HttpPost(Url_Login, value, NiconicoCokie);
            return result.IndexOf("エラー") == -1;
        }
    }
}
